<template>
	<view>
		
		<u-tabbar
			:value="value6"
			@change="name => value6 = name"
			:fixed="true"
			:placeholder="true"
			:safeAreaInsetBottom="true"
		>
			<u-tabbar-item :text="item.name" :icon="item.src" v-for="(item,index) in tabArr" :key="index"  @click="loadData(item,index)" :badge='index == 4 ? $store.state.cart.cartList.length:"0"'></u-tabbar-item>
			<!-- <u-tabbar-item text="放映厅" icon="photo" ></u-tabbar-item>
			<u-tabbar-item text="直播" icon="play-right" ></u-tabbar-item>
			<u-tabbar-item text="我的" icon="account" ></u-tabbar-item> -->
		</u-tabbar>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				value6:0,
				tabArr: [{
						name: '主页',
						bcid: '',
						target: '',
						src:"../../static/img2/home.png"
					},
					{
						name: '蛋糕',
						bcid: '1',
						target: '/pages/cake',
						src:"../../static/img2/food.png"
						
					},
					{
						name: '面包',
						bcid: '11',
						target: '/pages/bread',
						src:"../../static/img2/bread.png"
					},
					{
						name: '小食',
						bcid: '6',
						target: '/pages/food',
						src:"../../static/img2/smallfood.png"
					},
					{
						name: '购物车',
						// bcid: '0',
						target: '/pages/cart',
						src:"../../static/img2/shopcar.png"
					},
				],
				item:null
			};
		},
		methods:{
			loadData(item,index){
				if(index == 0){
					console.log(111);
					uni.navigateTo({
						url:'/pages/home/home'
					})
					return
				}else{
						this.$emit("loaddata",item)
				}
				
				if(index == 4){
					console.log(111);
					uni.navigateTo({
						url:'/pages/shopcar/shopcar'
					})
					return
				}
				// console.log(item);
				// this.item = item
				// console.log(this.item);
			
			}
		}
	}
</script>

<style lang="scss">

</style>
